from django.contrib.auth.models import AbstractUser
from django.db import models


# 注册时需要username, email, password
# 注册成功 返回: {
#     "username": "admin2",
#     "email": "admin2@b.com",
#     "id": 2
# }
# 登录时只需要username, password
class CustomUser(AbstractUser):
    USERNAME_FIELD = 'email'
    email = models.EmailField('邮箱', unique=True)
    REQUIRED_FIELDS = ('username',)  # createsuperuser需要

